﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    
      xmlns:Properties="clr-namespace:YalvLib.Strings;assembly=YalvLib"
      xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"

      xmlns:behav="clr-namespace:Themes.Behaviour"
    >

  <!-- COLORS -->
  <SolidColorBrush x:Key="DefaultForegroundColor" Color="#FF272727" PresentationOptions:Freeze="True" />
  <SolidColorBrush x:Key="BorderColor"            Color="#777" PresentationOptions:Freeze="True" />

  <LinearGradientBrush x:Key="GrayGradientBackground" EndPoint="0,1" StartPoint="0,0"
                       PresentationOptions:Freeze="True">
    <GradientStop Color="#AAA" Offset="0.0" />
    <GradientStop Color="#BBB" Offset="0.5" />
    <GradientStop Color="#BFBFBF" Offset="1.0" />
  </LinearGradientBrush>

  <!-- FONT -->
  <FontFamily x:Key="DefaultFontFamily">
    <!--Arial-->
    <!--Calibri-->
    <!--Georgia-->
    <!--Helvetica-->
    <!--Lucida Sans-->
    Segoe UI
    <!--Times New Roman-->
    <!--Verdana-->
  </FontFamily>

  <!-- FONTSIZE -->
  <sys:Double x:Key="DefaultFontSize">12</sys:Double>

  <Style x:Key="DefaultBorderStyle" TargetType="{x:Type Border}">
    <Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="CornerRadius" Value="3" />
  </Style>

  <!-- LEVEL COLORS -->
  <SolidColorBrush x:Key="DebugLevelColor" Color="LightBlue" PresentationOptions:Freeze="True" />
  <SolidColorBrush x:Key="InfoLevelColor" Color="#A0FFFFFF" PresentationOptions:Freeze="True" />
  <SolidColorBrush x:Key="WarnLevelColor" Color="Moccasin" PresentationOptions:Freeze="True" />
  <SolidColorBrush x:Key="ErrorLevelColor" Color="Salmon" PresentationOptions:Freeze="True" />
  <SolidColorBrush x:Key="FatalLevelColor" Color="Crimson" PresentationOptions:Freeze="True" />

  <!-- DATAGRID -->
  <Style x:Key="DefaultDataGridStyle" TargetType="{x:Type DataGrid}">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="RowHeight" Value="20" />
    <Setter Property="IsReadOnly" Value="True" />
    <Setter Property="HeadersVisibility" Value="Column" />
    <Setter Property="VerticalGridLinesBrush" Value="#8C6C6C6C" />
    <Setter Property="HorizontalGridLinesBrush" Value="#8C6C6C6C" />
    <Setter Property="AutoGenerateColumns" Value="False" />
    <Setter Property="SelectionMode" Value="Extended" />
    <Setter Property="SelectionUnit" Value="FullRow" />
    <Setter Property="CanUserAddRows" Value="False" />
    <Setter Property="CanUserDeleteRows" Value="False" />
    <Setter Property="CanUserReorderColumns" Value="False" />
    <Setter Property="CanUserResizeColumns" Value="True" />
    <Setter Property="CanUserSortColumns" Value="True" />
    <Setter Property="ClipboardCopyMode" Value="ExcludeHeader" />
    <Setter Property="Foreground" Value="White" />
    <Style.Triggers>
      <Trigger Property="HeadersVisibility" Value="Column">
        <!-- Workaround datagrid bug; refs: http://wpf.codeplex.com/discussions/47047 -->
        <Setter Property="RowHeaderWidth" Value="0" />
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="DefaultColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
    <Setter Property="Width" Value="8" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="Cursor" Value="SizeWE" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="DefaultDataGridHeaderStyle" TargetType="{x:Type DataGridColumnHeader}">
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="#80FFFFFF" />
    <Setter Property="Background" Value="#FF404040" />
    <Setter Property="Foreground" Value="{DynamicResource EditorForeground}" />
    <!-- Setter Property="FontWeight" Value="Bold" / -->
    <!-- Setter Property="FontSize" Value="11" / -->
    <!-- Setter Property="Height" Value="20" / -->
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
          <Grid>
            <Themes:DataGridHeaderBorder
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            IsClickable="{TemplateBinding CanUserSort}"
                            IsPressed="{TemplateBinding IsPressed}"
                            IsHovered="{TemplateBinding IsMouseOver}"
                            Padding="{TemplateBinding Padding}"
                            SortDirection="{TemplateBinding SortDirection}"
                            SeparatorBrush="{TemplateBinding SeparatorBrush}"
                            SeparatorVisibility="{TemplateBinding SeparatorVisibility}">
              <Grid>
                <ContentPresenter x:Name="PART_ContentPresenter"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

                <Path x:Name="SortArrow"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Center"
                      Margin="2,1,2,0"
                      Width="8"
                      Height="6"
                      Stretch="Fill"
                      Opacity="0.5"
                      Fill="White"
                      RenderTransformOrigin="0.5,0.4"
                      Visibility="Collapsed"
                      Data="M0,0 L1,0 0.5,1 z" />
              </Grid>
            </Themes:DataGridHeaderBorder>
            <Thumb x:Name="PART_LeftHeaderGripper"
                   HorizontalAlignment="Left"
                   Style="{StaticResource DefaultColumnHeaderGripperStyle}" />
            <Thumb x:Name="PART_RightHeaderGripper"
                   HorizontalAlignment="Right"
                   Style="{StaticResource DefaultColumnHeaderGripperStyle}" />
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger
                            Property="HorizontalContentAlignment"
                            Value="Left">
              <Setter
                                TargetName="PART_ContentPresenter"
                                Property="Margin"
                                Value="3,0,0,0" />
            </Trigger>
            <Trigger
                            Property="HorizontalContentAlignment"
                            Value="Right">
              <Setter
                                TargetName="PART_ContentPresenter"
                                Property="Margin"
                                Value="0,0,3,0" />
            </Trigger>
            <Trigger
                            Property="SortDirection"
                            Value="Ascending">
              <Setter
                                TargetName="SortArrow"
                                Property="Visibility"
                                Value="Visible" />
              <Setter
                                TargetName="SortArrow"
                                Property="RenderTransform">
                <Setter.Value>
                  <RotateTransform
                                        Angle="180" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger
                            Property="SortDirection"
                            Value="Descending">
              <Setter
                                TargetName="SortArrow"
                                Property="Visibility"
                                Value="Visible" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="DefaultDataGridCellStyle" TargetType="DataGridCell">
    <Setter Property="behav:MergeStyleBehaviour.AutoMergeStyle" Value="True"/> 
    <!-- Style.Triggers>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Foreground" Value="Yellow" />
      </Trigger>
    </Style.Triggers -->
  </Style>

  <Style x:Key="CenterDataGridCellStyle" BasedOn="{StaticResource DefaultDataGridCellStyle}" TargetType="DataGridCell">
    <Style.Setters>
      <Setter Property="TextBlock.TextAlignment" Value="Center" />
    </Style.Setters>
  </Style>

  <Style x:Key="LogItemDataGridRowStyle" TargetType="{x:Type DataGridRow}">
    <Setter Property="Background" Value="Black" />
    <Setter Property="ToolTip">
      <!-- Show details data on mouse over row -->
      <Setter.Value>
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
          </Grid.RowDefinitions>

          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Class_Text}" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=Class, Mode=OneWay}"                                Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left"  Margin="3" />

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Method_Text}"  Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=Method, Mode=OneWay}"                                 Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_File_Text}" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=File, Mode=OneWay}"                                Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Line_Text}" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=Line, Mode=OneWay}"                                Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_Thread_Text}" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=Thread, Mode=OneWay}"                                Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_TimeStamp_Text}" Grid.Row="5" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=TimeStamp, Mode=OneWay}"                                Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>

          <TextBlock Text="{x:Static Properties:Resources.MainWindow_DetailsBox_TimeDiff_Text}" Grid.Row="6" Grid.Column="0" HorizontalAlignment="Right" Margin="3"/>
          <TextBlock Text="{Binding Path=Delta, Mode=OneWay}"                                   Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left"  Margin="3"/>
        </Grid>
      </Setter.Value>
    </Setter>
    <Style.Triggers>

      <!-- Debug -->
      <DataTrigger Binding="{Binding Path=LevelIndex, Mode=OneWay}" Value="1">
        <Setter Property="Foreground" Value="{DynamicResource DebugLevelColor}" />
      </DataTrigger>

      <!-- Info -->
      <DataTrigger Binding="{Binding Path=LevelIndex, Mode=OneWay}" Value="2">
        <Setter Property="Foreground" Value="{DynamicResource InfoLevelColor}" />
      </DataTrigger>

      <!-- Warn -->
      <DataTrigger Binding="{Binding Path=LevelIndex, Mode=OneWay}" Value="3">
        <Setter Property="Foreground" Value="{DynamicResource WarnLevelColor}" />
      </DataTrigger>

      <!-- Error -->
      <DataTrigger Binding="{Binding Path=LevelIndex, Mode=OneWay}" Value="4">
        <Setter Property="Foreground" Value="{DynamicResource ErrorLevelColor}" />
      </DataTrigger>

      <!-- Fatal -->
      <DataTrigger Binding="{Binding Path=LevelIndex, Mode=OneWay}" Value="5">
        <Setter Property="Foreground" Value="{DynamicResource FatalLevelColor}" />
      </DataTrigger>

    </Style.Triggers>
  </Style>

</ResourceDictionary>